
<div xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ctg="http://www.crotouristguide.com/taglib">
	<h:form>
		<rich:panel styleClass="blue-panel">
		    <ctg:status />
			<s:decorate id="wizar" template="/templates/wizard.xhtml">
				<ui:define name="step-title">#{messages['label.suggest.step.title.2']}</ui:define>
				<ui:define name="wizard-img">
					<!--<h:graphicImage value="/theme/default/images/logocro_test.gif" alt="#{messages['label.image.alt']}" />-->
				</ui:define>
				<ui:define name="step-tip">#{messages['label.suggest.step.tip.2']}</ui:define>
				<ui:define name="step-form">
					<table width="100%">
						<tr>
							<td>
								<s:decorate id="tipAdreseDecoration"
									template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.address.type']}</ui:define>
									<h:selectOneMenu id="tipAdrese"
										styleClass="field" value="#{objektSuggest.adresa.tipAdrese}"
										required="true">
										<s:selectItems id="tipoviAdrese"
											value="#{objektSuggest.tipoviAdrese}" var="ta"
											label="#{messages[stringUtil.merge('label.address.type.',ta.idTipaAdrese)]}"
											noSelectionLabel="#{messages['label.suggest.selectvalue']}" />
										<s:convertEntity />
									</h:selectOneMenu>
								</s:decorate>
								<s:decorate id="zupanijaAdrDecoration"
									template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.objekt.county']}</ui:define>
									<h:selectOneMenu id="zupanijaAdr"
										styleClass="field"
										valueChangeListener="#{objektSuggest.zupanijaAdreseSelected}"
										immediate="true">
										<s:selectItems id="zupanije"
											value="#{objektSuggest.zupanijeObjekta}" var="z"
											label="#{z.naziv}"
											noSelectionLabel="#{messages['label.suggest.selectvalue']}" />
										<s:convertEntity />
										<a:support event="onchange"
											reRender="postaAdrDecoration,mjestoAdrDecoration" />
									</h:selectOneMenu>
								</s:decorate>
								<s:decorate id="postaAdrDecoration"
									template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.posta.naziv']}</ui:define>
									<h:selectOneMenu id="postaAdr"
										styleClass="field"
										valueChangeListener="#{objektSuggest.postaAdreseSelected}"
										immediate="true">
										<s:selectItems id="poste" binding="#{soComponents.posteAdrese}"
											var="p" label="#{p.naziv}"
											noSelectionLabel="#{messages['label.suggest.selectvalue']}" />
										<s:convertEntity />
										<a:support event="onchange" reRender="mjestoAdrDecoration" />
									</h:selectOneMenu>
								</s:decorate>
								<s:decorate id="mjestoAdrDecoration"
									template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.mjesto.naziv']}</ui:define>
									<h:selectOneMenu id="mjestoAdr"
										styleClass="field" value="#{objektSuggest.adresa.mjesto}">
										<s:selectItems id="mjesta"
											value="#{objektSuggest.mjestaAdrese}" var="m"
											label="#{m.naziv}"
											noSelectionLabel="#{messages['label.suggest.selectvalue']}" />
										<s:convertEntity />
									</h:selectOneMenu>
								</s:decorate>
								<a:commandButton styleClass="submit"
									value="#{messages['label.address.input.button.addaddress']}"
									action="#{objektSuggest.dodajAdresu}" reRender="wizardpanel,tipAdreseDecoration, tipoviAdrese" />
							</td>
							<td valign="top">
								<s:decorate id="primateljAdresaDecoration"
									template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.address.reciever']}</ui:define>
									<h:inputText id="primatelj"
										styleClass="field" value="#{objektSuggest.adresa.primatelj}">
									</h:inputText>
								</s:decorate>
								<s:decorate id="ulicaDecoration"
									template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.address.street']}</ui:define>
									<h:inputText id="ulica" styleClass="field"
										value="#{objektSuggest.adresa.ulica}" required="true">
									</h:inputText>
								</s:decorate>
								<s:decorate id="brojDecoration" template="/templates/edit.xhtml">
									<ui:define name="label">#{messages['label.address.number']}</ui:define>
									<h:inputText id="brojUlice"
										styleClass="field" value="#{objektSuggest.adresa.broj}">
									</h:inputText>
								</s:decorate>
							</td>
						</tr>
					</table>


				</ui:define>
				<ui:define name="buttn-cancel">
					<h:commandButton styleClass="submit"
							value="#{messages['label.objekt.input.button.update']}"
							action="#{objektSuggest.zapisiObjekt}" rendered="#{objektSuggest.editMode}" immediate="true"/>	
					<ctg:nbsp/>
					<a:commandButton value="#{messages['label.input.cancel']}"
						action="end" immediate="true" />
				</ui:define>
				<ui:define name="buttn-prev">
					
					<h:commandButton value="#{messages['label.input.back']}"
						action="#{objektSuggest.previousStep}"   immediate="true" />	
				</ui:define>
				<ui:define name="buttn-next">				
					<a:commandButton value="#{messages['label.input.next']}"
						action="#{objektSuggest.nextStep}" reRender="wizardpanel"
						immediate="true" />
				</ui:define>
				<ui:define name="step-entered-data">
					<s:decorate id="edataXXX">
						<h:dataTable value="#{objektSuggest.uneseneAdrese}" var="ua"
							columnClasses="col"
							rendered="#{! empty objektSuggest.uneseneAdrese}" rowClasses="rowOdd,rowEven">
							<f:facet name="header">#{messages['label.address.list.title']}</f:facet>
							<h:column>
								<f:facet name="header">#{messages['label.address.type']}</f:facet>
								<h:outputText value="#{messages[stringUtil.merge('label.address.type.',ua.tipAdrese.idTipaAdrese)]}" />
							</h:column>
							<h:column>
								<f:facet name="header">#{messages['label.address.reciever']}</f:facet>
								<h:outputText value="#{ua.primatelj}" />
							</h:column>
							<h:column>
								<f:facet name="header">#{messages['label.address.street']}</f:facet>
								<h:outputText value="#{ua.ulica} #{ua.broj}" />
							</h:column>
							<h:column>
								<f:facet name="header">#{messages['label.mjesto.naziv']}</f:facet>
								<h:outputText
									value="#{ua.mjesto.naziv}, #{ua.mjesto.posta.postanskiBroj} #{ua.mjesto.posta.naziv}" />
							</h:column>
							<h:column>
								<f:facet name="header">Akcije</f:facet>
								<a:commandLink styleClass="submit"
									value="#{messages['label.button.remove']}"
									action="#{objektSuggest.ukloniAdresu(ua)}" reRender="wizardpanel, tipAdreseDecoration" immediate="true"/>
							</h:column>
						</h:dataTable>
					</s:decorate>
				</ui:define>
			</s:decorate>
		</rich:panel>

	</h:form>

</div>